package com.company.nuwa.common.enumration;

import java.util.Objects;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * <p>终端类型： customer_user_mp-用户端小程序 employee_mp 员工端小程序</p>
 *
 * @author lili
 * @version 1.0: TerminalTypeEnum.java
 * @date 2024/1/29 16:19
 */
@Getter
@AllArgsConstructor
public enum TerminalTypeEnum {
                              /**
                               * 员工端小程序
                               */
                              EMPLOYEE_MP("EMPLOYEE_MP", "员工端小程序/公众号"),
                              /**
                               * 用户端小程序
                               */
                              CUSTOMER_USER_MP("CUSTOMER_USER_MP", "用户端小程序/公众号"),

                              /**
                               * 运营平台
                               */
                              PLATFORM_BACKEND("PLATFORM_BACKEND", "运营平台"),

                              /**
                               * 商户后台
                               */
                              MERCHANT_BACKEND("MERCHANT_BACKEND", "商户后台"),

    ;

    /**
     * 终端类型
     */
    private String type;
    /**
     * 终端名称
     */
    private String name;

    public static TerminalTypeEnum getByType(String type) {
        if (Objects.isNull(type)) {
            return null;
        }
        for (TerminalTypeEnum temp : TerminalTypeEnum.values()) {
            if (temp.getType().equals(type)) {
                return temp;
            }
        }
        return null;
    }
}
